public class SkillTree {
    public SkillNode root;

    public SkillTree() {
        root = new SkillNode("技能树根");
        root.left = new SkillNode("加速");
        root.right = new SkillNode("无敌");
        root.left.left = new SkillNode("分数加成");
        root.right.right = new SkillNode("穿墙");
    }

    public int countNodes(SkillNode node) {
        if (node == null) return 0;
        return 1 + countNodes(node.left) + countNodes(node.right);
    }
    public int depth(SkillNode node) {
        if (node == null) return 0;
        return 1 + Math.max(depth(node.left), depth(node.right));
    }
    public int countLeaves(SkillNode node) {
        if (node == null) return 0;
        if (node.left == null && node.right == null) return 1;
        return countLeaves(node.left) + countLeaves(node.right);
    }
    public void print(SkillNode node, String prefix) {
        if (node == null) return;
        System.out.println(prefix + node.name);
        print(node.left, prefix + "  ");
        print(node.right, prefix + "  ");
    }
}